import { IsNotEmpty, Length, ValidateIf } from 'class-validator';

export class CreateFileDto {
  @IsNotEmpty()
  @Length(1, 255, { message: `url最多255个字符` })
  url: string;

  @ValidateIf((o) => !o.expire)
  @Length(8, 8, { message: `有效期只能有8个字符` })
  expire: string;

  @ValidateIf((o) => !o.payload)
  @Length(1, 1024, { message: `载荷最多1024个字符` })
  payload: string;
}
